//
//  ST_SmartSecretaryViewController.swift
//  btvideo
//
//  Created by Jason on 2021/8/6.
//  Copyright © 2021 JarvanZhang. All rights reserved.
//

import UIKit

class ST_SmartSecretaryViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.addSubview(root_view)
        root_view.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.width.equalTo(300)
            make.height.equalTo(352)
        }
        
        
        root_view.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.height.equalTo(25)
            make.top.equalToSuperview().offset(40)
        }
        
        root_view.addSubview(QRCodeImageView)
        QRCodeImageView.snp.makeConstraints { make in
            make.width.height.equalTo(180)
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(80)
        }
        
        
        
        root_view.addSubview(subtitleLabel0)
        subtitleLabel0.snp.makeConstraints { make in
            make.height.equalTo(20)
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(276)
        }
        
        root_view.addSubview(subtitleLabel1)
        subtitleLabel1.snp.makeConstraints { make in
            make.height.equalTo(20)
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(302)
        }
        
        view.addSubview(close_btn)
        close_btn.snp.makeConstraints { (make) in
            make.bottom.equalTo(root_view.snp.top).offset(-4)
            make.right.equalTo(root_view).offset(5)
            make.width.height.equalTo(44)
        }
        
//        secretaryJson
    }
    
    
    fileprivate lazy var root_view:UIView = {
        let l = UIView()
        l.cornerRadius = 20
        l.backgroundColor = .white
        return l
    }()
    fileprivate lazy var close_btn:UIButton = {
        
        let control = UIButton.init(type: UIButton.ButtonType.custom)
        control.setImage(ST_ImageUtils.imageName("注册_icon_关闭"), for: UIControl.State.normal)
        control.addTarget(self, action: #selector(cancel_handle), for: UIControl.Event.touchUpInside)
        return control
    }()
    
    fileprivate lazy var QRCodeImageView:UIImageView = {
        let v = UIImageView()
        v.contentMode = .scaleAspectFill
        v.clipsToBounds = true
        v.pin_setImage(from: ST_SwiftConst.shared.secretaryJson["img"].url)
        return v
    }()
    
    fileprivate lazy var titleLabel:UILabel = {
        let l = UILabel()
        l.font = UIFont.systemFont(ofSize: 18, weight: .medium)
        l.textColor = #colorLiteral(red: 0.2, green: 0.2, blue: 0.2, alpha: 1)
        l.text = ST_SwiftConst.shared.secretaryJson["title1"].stringValue
        return l
    }()
    
    fileprivate lazy var subtitleLabel0:UILabel = {
        let l = UILabel()
        l.font = UIFont.systemFont(ofSize: 14, weight: .regular)
        l.textColor = #colorLiteral(red: 0.3803921569, green: 0.4, blue: 0.4352941176, alpha: 1)
        l.text = "手机截图保存二维码"
        return l
    }()
    
    fileprivate lazy var subtitleLabel1:UILabel = {
        let l = UILabel()
        l.font = UIFont.systemFont(ofSize: 14, weight: .regular)
        l.textColor = #colorLiteral(red: 0.3803921569, green: 0.4, blue: 0.4352941176, alpha: 1)
        l.text = ST_SwiftConst.shared.secretaryJson["title2"].stringValue
        return l
    }()
}

extension ST_SmartSecretaryViewController{
    
    @objc func cancel_handle(){
        
        goback_previous_controller()
        
    }
}
